Prev Next |
Data Structuring can influence the performance. If the logic for home page news articles is to present the latest three, the logic of looking for articles structured as /year/month/day/article is faster than sorting a large number of articles stored directly under /news.
1. Speeding up Sitecore Development Installation
There are a number of options to speed up the Sitecore development installation:
-
Disable the indexes.
Indexes are responsible for the search bar in Sitecore taskbar. If you can work without it, then comment out the <indexes> section inside the database section in web.config (that is most probably /databases/master/indexes). The search will be disabled, along with index updates on each item create/update/delete operation.
- Switch your site to the 'live' mode. Live mode completely eliminates the need for publishing, which can be annoying in development scenarios, by taking all items directly from the content authoring database. To activate this go to your website in <sites> section of web.config (the site is called 'website' by default) and change database="web" to database="master". This is the way Sitecore client site works with the core database. Naturally, by switching the publishing off you also lose the publishing restrictions, that is 'do not publish/publish date' features.
2. Link Database
Sometimes it is required to get all Items in the database based on a given template. Iterating through the entire database may be a very expensive operation though.
However in this particular case, we can resort to the Link database. Link database is used by Sitecore to resolve all the linking issues - what referrers and what references the Item has. And if an item is based on a template, it also counts as a reference from the item to the template. The solution then is very simple: get all the referrers for a given template item.
Below you can see how Link Database is used in the RSS module architecture:
private static Item[] GetFeedsInDatabase(Database database, Language language)
{
TemplateItem feedTemplate = database.Templates[Constants.FeedTemplateID];
if (feedTemplate == null)
{
return null;
}
// Get all items refering to the feed template
ItemLink[] links = Globals.LinkDatabase.GetReferers(feedTemplate.InnerItem);
if (links == null)
{
return null;
}
ArrayList result = new ArrayList(links.Length);
// and filter the referers - we dont need to include masters
foreach(ItemLink link in links)
{
if (link.SourceDatabaseName == database.Name)
{
Item item = database.Items[link.SourceItemID, language];
if ((item != null) && (IsMaster(item) == false))
{
result.Add(item);
}
}
}
return (Item[])result.ToArray(typeof(Item));
}
See also:
Prev Next